Fixes #136105.
authorFederico Mena Quintero <federico@ximian.com>
Mon, 8 Mar 2004 22:21:47 +0000 (22:21 +0000)
committerFederico Mena Quintero <federico@src.gnome.org>
Mon, 8 Mar 2004 22:21:47 +0000 (22:21 +0000)
2004-03-08  Federico Mena Quintero  <federico@ximian.com>

Fixes #136105.

* gtk/gtkfilechooserembed.h (struct _GtkFileChooserEmbedIface):
Added an ::initial_focus() method.

* gtk/gtkfilechooserembed.c
(_gtk_file_chooser_embed_delegate_iface_init): Set the
initial_focus method.
(delegate_initial_focus): Implement.
(_gtk_file_chooser_embed_initial_focus): New function.

* gtk/gtkfilechooserdialog.c
(gtk_file_chooser_dialog_constructor): Call
_gtk_file_chooser_embed_initial_focus().

* gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_init):
Install the ::initial_focus() handler.
(gtk_file_chooser_default_initial_focus): Implement.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkfilechooserdefault.c
gtk/gtkfilechooserdialog.c
gtk/gtkfilechooserembed.c
gtk/gtkfilechooserembed.h

index 1e9420462bd89f3d752303a97cf962357a35b431..0dba3d3259d0c14ed79017bdb87db35342539dc2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2004-03-08  Federico Mena Quintero  <federico@ximian.com>
+
+       Fixes #136105.
+
+       * gtk/gtkfilechooserembed.h (struct _GtkFileChooserEmbedIface):
+       Added an ::initial_focus() method.
+
+       * gtk/gtkfilechooserembed.c
+       (_gtk_file_chooser_embed_delegate_iface_init): Set the
+       initial_focus method.
+       (delegate_initial_focus): Implement.
+       (_gtk_file_chooser_embed_initial_focus): New function.
+
+       * gtk/gtkfilechooserdialog.c
+       (gtk_file_chooser_dialog_constructor): Call
+       _gtk_file_chooser_embed_initial_focus().
+
+       * gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_init):
+       Install the ::initial_focus() handler.
+       (gtk_file_chooser_default_initial_focus): Implement.
+
 2004-03-08  Federico Mena Quintero  <federico@ximian.com>
 
        * gtk/gtkfilechooserdefault.c (update_from_entry): Return a
index 1e9420462bd89f3d752303a97cf962357a35b431..0dba3d3259d0c14ed79017bdb87db35342539dc2 100644 (file)
@@ -1,3 +1,24 @@
+2004-03-08  Federico Mena Quintero  <federico@ximian.com>
+
+       Fixes #136105.
+
+       * gtk/gtkfilechooserembed.h (struct _GtkFileChooserEmbedIface):
+       Added an ::initial_focus() method.
+
+       * gtk/gtkfilechooserembed.c
+       (_gtk_file_chooser_embed_delegate_iface_init): Set the
+       initial_focus method.
+       (delegate_initial_focus): Implement.
+       (_gtk_file_chooser_embed_initial_focus): New function.
+
+       * gtk/gtkfilechooserdialog.c
+       (gtk_file_chooser_dialog_constructor): Call
+       _gtk_file_chooser_embed_initial_focus().
+
+       * gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_init):
+       Install the ::initial_focus() handler.
+       (gtk_file_chooser_default_initial_focus): Implement.
+
 2004-03-08  Federico Mena Quintero  <federico@ximian.com>
 
        * gtk/gtkfilechooserdefault.c (update_from_entry): Return a
index 1e9420462bd89f3d752303a97cf962357a35b431..0dba3d3259d0c14ed79017bdb87db35342539dc2 100644 (file)
@@ -1,3 +1,24 @@
+2004-03-08  Federico Mena Quintero  <federico@ximian.com>
+
+       Fixes #136105.
+
+       * gtk/gtkfilechooserembed.h (struct _GtkFileChooserEmbedIface):
+       Added an ::initial_focus() method.
+
+       * gtk/gtkfilechooserembed.c
+       (_gtk_file_chooser_embed_delegate_iface_init): Set the
+       initial_focus method.
+       (delegate_initial_focus): Implement.
+       (_gtk_file_chooser_embed_initial_focus): New function.
+
+       * gtk/gtkfilechooserdialog.c
+       (gtk_file_chooser_dialog_constructor): Call
+       _gtk_file_chooser_embed_initial_focus().
+
+       * gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_init):
+       Install the ::initial_focus() handler.
+       (gtk_file_chooser_default_initial_focus): Implement.
+
 2004-03-08  Federico Mena Quintero  <federico@ximian.com>
 
        * gtk/gtkfilechooserdefault.c (update_from_entry): Return a
index 1e9420462bd89f3d752303a97cf962357a35b431..0dba3d3259d0c14ed79017bdb87db35342539dc2 100644 (file)
@@ -1,3 +1,24 @@
+2004-03-08  Federico Mena Quintero  <federico@ximian.com>
+
+       Fixes #136105.
+
+       * gtk/gtkfilechooserembed.h (struct _GtkFileChooserEmbedIface):
+       Added an ::initial_focus() method.
+
+       * gtk/gtkfilechooserembed.c
+       (_gtk_file_chooser_embed_delegate_iface_init): Set the
+       initial_focus method.
+       (delegate_initial_focus): Implement.
+       (_gtk_file_chooser_embed_initial_focus): New function.
+
+       * gtk/gtkfilechooserdialog.c
+       (gtk_file_chooser_dialog_constructor): Call
+       _gtk_file_chooser_embed_initial_focus().
+
+       * gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_init):
+       Install the ::initial_focus() handler.
+       (gtk_file_chooser_default_initial_focus): Implement.
+
 2004-03-08  Federico Mena Quintero  <federico@ximian.com>
 
        * gtk/gtkfilechooserdefault.c (update_from_entry): Return a
index 1e9420462bd89f3d752303a97cf962357a35b431..0dba3d3259d0c14ed79017bdb87db35342539dc2 100644 (file)
@@ -1,3 +1,24 @@
+2004-03-08  Federico Mena Quintero  <federico@ximian.com>
+
+       Fixes #136105.
+
+       * gtk/gtkfilechooserembed.h (struct _GtkFileChooserEmbedIface):
+       Added an ::initial_focus() method.
+
+       * gtk/gtkfilechooserembed.c
+       (_gtk_file_chooser_embed_delegate_iface_init): Set the
+       initial_focus method.
+       (delegate_initial_focus): Implement.
+       (_gtk_file_chooser_embed_initial_focus): New function.
+
+       * gtk/gtkfilechooserdialog.c
+       (gtk_file_chooser_dialog_constructor): Call
+       _gtk_file_chooser_embed_initial_focus().
+
+       * gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_init):
+       Install the ::initial_focus() handler.
+       (gtk_file_chooser_default_initial_focus): Implement.
+
 2004-03-08  Federico Mena Quintero  <federico@ximian.com>
 
        * gtk/gtkfilechooserdefault.c (update_from_entry): Return a
index 84f6d86048f934611c057fe995d45128cd9c9219..e24d3edd8a62194e782b90e0b0496ee7f6011883 100644 (file)
@@ -274,6 +274,7 @@ static void           gtk_file_chooser_default_get_resizable_hints    (GtkFileCh
                                                                       gboolean            *resize_horizontally,
                                                                       gboolean            *resize_vertically);
 static gboolean       gtk_file_chooser_default_should_respond         (GtkFileChooserEmbed *chooser_embed);
+static void           gtk_file_chooser_default_initial_focus          (GtkFileChooserEmbed *chooser_embed);
 
 static void location_popup_handler (GtkFileChooserDefault *impl);
 static void up_folder_handler      (GtkFileChooserDefault *impl);
@@ -496,6 +497,7 @@ gtk_file_chooser_embed_default_iface_init (GtkFileChooserEmbedIface *iface)
   iface->get_default_size = gtk_file_chooser_default_get_default_size;
   iface->get_resizable_hints = gtk_file_chooser_default_get_resizable_hints;
   iface->should_respond = gtk_file_chooser_default_should_respond;
+  iface->initial_focus = gtk_file_chooser_default_initial_focus;
 }
 static void
 gtk_file_chooser_default_init (GtkFileChooserDefault *impl)
@@ -3561,6 +3563,30 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
   return FALSE;
 }
 
+/* Implementation for GtkFileChooserEmbed::initial_focus() */
+static void
+gtk_file_chooser_default_initial_focus (GtkFileChooserEmbed *chooser_embed)
+{
+  GtkFileChooserDefault *impl;
+  GtkWidget *widget;
+
+  impl = GTK_FILE_CHOOSER_DEFAULT (chooser_embed);
+
+  if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
+      || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+    widget = impl->browse_files_tree_view;
+  else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
+          || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+    widget = impl->save_file_name_entry;
+  else
+    {
+      g_assert_not_reached ();
+      widget = NULL;
+    }
+
+  gtk_widget_grab_focus (widget);
+}
+
 static void
 set_current_filter (GtkFileChooserDefault *impl,
                    GtkFileFilter         *filter)
index 2835b062e7b88b58ffa1500c04ad1ffea49ffaf1..14f4b8b90b50c21428cb72bb7b355743b6314c70 100644 (file)
@@ -331,6 +331,8 @@ gtk_file_chooser_dialog_constructor (GType                  type,
   else
     priv->widget = g_object_new (GTK_TYPE_FILE_CHOOSER_WIDGET, NULL);
 
+  _gtk_file_chooser_embed_initial_focus (GTK_FILE_CHOOSER_EMBED (priv->widget));
+
   g_signal_connect (priv->widget, "file-activated",
                    G_CALLBACK (file_chooser_widget_file_activated), object);
   g_signal_connect (priv->widget, "default-size-changed",
index 0705ff8f413db4617dc036f77ab53f1f28ca5adc..3e3b625032076fa7aed3edf307cfc5d54d7988e7 100644 (file)
@@ -10,6 +10,7 @@ static void delegate_get_resizable_hints      (GtkFileChooserEmbed *chooser_embe
                                               gboolean            *resize_horizontally,
                                               gboolean            *resize_vertically);
 static gboolean delegate_should_respond       (GtkFileChooserEmbed *chooser_embed);
+static void delegate_initial_focus            (GtkFileChooserEmbed *chooser_embed);
 static void delegate_default_size_changed     (GtkFileChooserEmbed *chooser_embed,
                                               gpointer             data);
 
@@ -34,6 +35,7 @@ _gtk_file_chooser_embed_delegate_iface_init (GtkFileChooserEmbedIface *iface)
   iface->get_default_size = delegate_get_default_size;
   iface->get_resizable_hints = delegate_get_resizable_hints;
   iface->should_respond = delegate_should_respond;
+  iface->initial_focus = delegate_initial_focus;
 }
 
 /**
@@ -83,6 +85,12 @@ delegate_should_respond (GtkFileChooserEmbed *chooser_embed)
   return _gtk_file_chooser_embed_should_respond (get_delegate (chooser_embed));
 }
 
+static void
+delegate_initial_focus (GtkFileChooserEmbed *chooser_embed)
+{
+  return _gtk_file_chooser_embed_initial_focus (get_delegate (chooser_embed));
+}
+
 static void
 delegate_default_size_changed (GtkFileChooserEmbed *chooser_embed,
                               gpointer             data)
@@ -152,6 +160,14 @@ _gtk_file_chooser_embed_should_respond (GtkFileChooserEmbed *chooser_embed)
   return GTK_FILE_CHOOSER_EMBED_GET_IFACE (chooser_embed)->should_respond (chooser_embed);
 }
 
+void
+_gtk_file_chooser_embed_initial_focus (GtkFileChooserEmbed *chooser_embed)
+{
+  g_return_if_fail (GTK_IS_FILE_CHOOSER_EMBED (chooser_embed));
+
+  GTK_FILE_CHOOSER_EMBED_GET_IFACE (chooser_embed)->initial_focus (chooser_embed);
+}
+
 void
 _gtk_file_chooser_embed_get_resizable_hints (GtkFileChooserEmbed *chooser_embed,
                                             gboolean            *resize_horizontally,
index 7c6d6bb31e6e14813742fb9849205ed1b567dfb0..4a02e947af6dfcfd15c7d8b254b29f5a8773815c 100644 (file)
@@ -48,6 +48,8 @@ struct _GtkFileChooserEmbedIface
                                   gboolean            *resize_vertically);
 
   gboolean (*should_respond)      (GtkFileChooserEmbed *chooser_embed);
+
+  void (*initial_focus)           (GtkFileChooserEmbed *chooser_embed);
   /* Signals
    */
   void (*default_size_changed)    (GtkFileChooserEmbed *chooser_embed);
@@ -64,6 +66,8 @@ void  _gtk_file_chooser_embed_get_resizable_hints (GtkFileChooserEmbed *chooser_
 
 gboolean _gtk_file_chooser_embed_should_respond (GtkFileChooserEmbed *chooser_embed);
 
+void _gtk_file_chooser_embed_initial_focus (GtkFileChooserEmbed *chooser_embed);
+
 void _gtk_file_chooser_embed_delegate_iface_init  (GtkFileChooserEmbedIface *iface);
 void _gtk_file_chooser_embed_set_delegate         (GtkFileChooserEmbed *receiver,
                                                   GtkFileChooserEmbed *delegate);